//
//  XMMessageController.m
//  XMWeibo
//
//  Created by chi on 14-8-20.
//  Copyright (c) 2014年 xiaoming. All rights reserved.
//

#import "XMMessageController.h"

@interface XMMessageController ()

@end

@implementation XMMessageController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    
    //标题栏右边按钮
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"写私信" style:UIBarButtonItemStylePlain target:self action:@selector(writeMessage)];
    
    [self setupGroup1];
    
    

    if (isIOS7) {
        self.tableView.contentInset = UIEdgeInsetsMake(-10.0, 0, 0, 0);
    }
    else {
        self.tableView.sectionHeaderHeight = 10.0;
    }
    
}

- (void)viewDidAppear:(BOOL)animated
{
    [super viewDidAppear:animated];
    
    XMGroupInfo *group = [self.dataList lastObject];
    if (group && group.cellItems.count == 4) {
        XMBaseSettingItem *item = [group.cellItems lastObject];
        item.badgeValue = self.tabBarItem.badgeValue;
        
        [self.tableView reloadData];
    }
    
}

- (void)setupGroup1
{
    XMGroupInfo *group1 = [self addGroup];
    
    XMBaseSettingItem *at_me = [XMArrowSettingItem arrowCellItemWithTitle:@"@我的" subTitle:nil icon:@"messagescenter_at" class:nil];
    at_me.badgeValue = @"测试";
    
    XMBaseSettingItem *comments = [XMArrowSettingItem arrowCellItemWithTitle:@"评论" subTitle:@"(微博评论)" icon:@"messagescenter_comments" class:nil];
    comments.badgeValue = @"new";
    
    XMBaseSettingItem *good = [XMArrowSettingItem arrowCellItemWithTitle:@"赞" subTitle:nil icon:@"messagescenter_good" class:nil];
    
    XMBaseSettingItem *msg = [XMArrowSettingItem arrowCellItemWithTitle:@"私信" subTitle:@"(私信信信信)" icon:@"messagescenter_messagebox" class:nil];
    msg.badgeValue = @"32";
    
    group1.cellItems = @[at_me, comments, good, msg];
}

- (void)writeMessage
{
    
}

@end
